home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 September / macformat-004.iso / Shareware City / Graphics / VideoToolbox ƒ / VideoToolboxSources / MaximizeConsoleHeight.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-07  |  3.0 KB  |  68 lines  |  [TEXT/KAHL]

  1. /*
  2. MaximizeConsoleHeight.c
  3. THINK C provides a built-in console. That console is less useful than it might
  4. be because it opens to only a small size, presumably designed to fit on the tiny
  5. screen of a Mac Plus, i.e. the lowest common denominator, for portability. This
  6. routine requests that the console open to the full height of your main screen.
  7. This makes good use of your screen, while maintaining the portability of your
  8. application. Call MaximizeConsoleHeight() BEFORE opening the console in THINK C,
  9. i.e. before your first printf().
  10.  
  11. To change the WIDTH of your THINK C console do this:
  12. #include <console.h>
  13. ...
  14. console_options.ncols=100;
  15.  
  16. LIMITATION:
  17. In June 1994 Mike Garver reported that on a Mac Plus running System 6.07 with an
  18. attached big screen the console window appears on the Mac Plus screen, as it
  19. should, but extends well past the bottom, "so I could see none of the text
  20. unless I moved the window onto the large screen." This happens because, when
  21. Color QuickDraw is not available, MaximizeConsoleHeight() resorts to using the
  22. CrsrPin rect to estimate the height of the main screen. (CrsrPin is the
  23. rectangle to which the cursor is confined. When the desktop isn't rectangular
  24. CrsrPin is the smallest rectangle that contains the desktop.) I don't know how
  25. to fix this. If Color QuickDraw were running then the program would have
  26. correctly gotten the bounds of the main device, but the computer lacks Color
  27. QuickDraw, so there are no video device records, nor a GrayRgn structure to
  28. consult. Since MaximizeConsoleHeight() is typically called before QuickDraw is
  29. initialized we can't use qd.screenBits.bounds (which is probably the same as
  30. CrsrPin rect anyway). I can't think of any way for this program to find out the
  31. correct height of the main screen under these circumstances. So I blame this on
  32. the necessary cludge implicit in having two screens in a computer lacking Color
  33. QuickDraw, since 1-bit QuickDraw doesn't really support multiple screens. I
  34. believe, but didn't confirm, that System 7 provides 32-bit QuickDraw (which
  35. includes Color QuickDraw) on all computers.
  36.  
  37. HISTORY:
  38. 1/92    dgp wrote it.
  39. 8/27/92    dgp    check for 8-bit quickdraw before using GDevices.
  40. 10/10/92 dgp Reduced maximum console height by one pixel, so as not to clip 
  41.             displayed text.
  42. 2/22/93    dgp replaced GetMBarHeight() by MBarHeight.
  43. 4/16/93    dgp    enhanced to actively support 1-bit QD, rather than doing nothing.
  44. 6/3/94    dgp    replaced low-memory global MBarHeight by GetMBarHeight().
  45. 6/21/94 dgp documented limitation above.
  46. */
  47.  
  48. #include "VideoToolbox.h"
  49. #if THINK_C
  50.     #include <LoMem.h>    // CrsrPin
  51.     #include <console.h>
  52. #endif
  53.  
  54. void MaximizeConsoleHeight(void)
  55. {
  56. #if THINK_C
  57.     long qD;
  58.     Rect r;
  59.     
  60.     Gestalt(gestaltQuickdrawVersion,&qD);
  61.     console_options.top=GetMBarHeight()+19;
  62.     console_options.left=1;
  63.     if(qD>=gestalt8BitQD) r=(**(**GetMainDevice()).gdPMap).bounds;
  64.     else r=CrsrPin;    // Can't use qd.screenBits.bounds 'cause qd may not yet be inited.
  65.     console_options.nrows=r.bottom-4-console_options.top;
  66.     console_options.nrows/=console_options.txSize*4/3-1; /* estimate line spacing */
  67. #endif
  68. }